<div class="find-app" id="app">
    <!-- public-head -->
    <div class="header-mobile">
        <a class="nav-back" href="javascript:history.go(-1)">
            <img class="icon" src="__CDN__/assets/img/return@2x.png" alt="">
        </a>
        <h1 class="nav-title">提现</h1>
    </div>
    <div class="main-wrapper">
        <div class="withdraw-wrapper">
            <div class="section-floor">
                <div class="head-panel">
                    <p class="title">提现金额</p>
                    <div class="input-wrapper">
                        <div class="inner">
                            <span class="symbol">￥</span>
                            <input class="input" type="number" v-model="postData.money" placeholder="请输入提现金额">
                        </div>
                        <span class="btn" @click="postData.money = {$user.money}">全部提现</span>
                    </div>
                    <p class="max-withdraw">可提现金额: {$user.money}元</p>
                    <p class="min-withdraw">最低提现金额为{{lowsum}}元</p>
                </div>
            </div>
            <div class="withdraw-title">提现账户管理</div>
            <div class="section-floor">
                <div class="body-panel">
                    <div class="title-inner">
                        <span>微信提现</span><span>{$user.nickname}</span>
                    </div>
                    <div class="btn-wrapper">
                        <div v-if="postData.money!==''" class="btn active" @click="submit()">提现</div>
                        <div v-else class="btn">提现</div>
                    </div>
                    {if condition="$user.is_authentic neq 0"}
                    <p class="tip">您已经认证</p>
                    {else /}
                    <p class="tip">您还未认证，请<a href="{:url('user/authentic')}"><span class="tip-btn">立即身份认证</span></a>后提现
                    </p>
                    {/if}

                    <div class="notice-panel">
                        <p class="title">注意:</p>
                        <p class="txt">金额低于1元不可提现</p>
                        <p class="txt">预计三个工作日可到账</p>
                        <p class="txt">未实名认证的微信用户，将无法提现到微信钱包</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    let index = new Vue({
        el: '#app',
        data: {
            lowsum: 0,
            list: [],
            postData: {
                money: '',
                weChatCcount: '{$user.nickname}'
            }
        },
        created() {
            // this.jumpDomain = "{:url('index/detail')}"
        },
        mounted() {
            this.ajax()
            // this.wrapperHeight = document.documentElement.clientHeight - this.$refs.wrapper.getBoundingClientRect().top;
        },
        methods: {
            ajax() {
                let self = this;
                axios({
                    method: "post",
                    url: "{:url('user/postal')}",
                    data: {
                        RequestName: 'ajax'
                    },
                    headers: {
                        'X-Requested-With': 'XMLHttpRequest'
                    }
                }).then(res => {
                    if (res.data.code == 1) {
                        this.lowsum = res.data.data;
                    }
                })
            },
            loadMore() {},
            submit() {
                let self = this
                axios({
                    method: "post",
                    url: "{:url('user/postal')}",
                    data: this.postData,
                    headers: {
                        'X-Requested-With': 'XMLHttpRequest'
                    }
                }).then(res => {
                    if (res.data.code == 1) {
                        self.$messagebox({
                            title: res.data.msg
                        }).then(rest => {
                            if (rest === 'confirm') {
                                self.$messagebox({
                                    title: res.data.msg
                                }).then(rest => {
                                    javascript: history.go(-1);
                                })

                            }
                        })

                    } else {
                        self.$messagebox(res.data.msg)
                    }
                })
            }
        }
    })
</script>